package com.jule.chat.network.process;

import com.jule.chat.google.protocol.Heartbeat;
import com.jule.chat.network.FunctionFactory;
import com.jule.chat.network.protocol.Request;
import io.netty.buffer.ByteBuf;

public class PingReq_50000 extends Request {
    public PingReq_50000(int functionId) {
        super(functionId);
    }

    @Override
    public void readPayLoadImpl(ByteBuf buf) throws Exception {
        byte[] blob = new byte[buf.readableBytes()];
        buf.readBytes(blob);
        Heartbeat.Ping ping = Heartbeat.Ping.parseFrom(blob);
        //dummy
    }

    @Override
    public void processImpl() throws Exception {
        FunctionFactory.getInstance().getResponse(functionId | 0xFF000000,Heartbeat.Pong.getDefaultInstance()).send(ctx);
    }
}
